// app.js
App({
  onLaunch() {
    var that = this;
    // 展示本地存储能力
    const logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)
    //续命操作
    setInterval(function () {
      console.log('想要续命');
      if (that.globalData.hasLogin) {
        console.log('开始');
        wx.request({
          url: that.globalData.myUrl+'/delayed',
          method: 'GET',
          data: {
            token : that.globalData.token
          },
          success: function (res) {
            console.log(res.data.msg);
          }
        })
      }
    }, 1500000);
  },

  //全局数据
  globalData: {
    userInfo: null,
    hasLogin: false,
    token: null,

    //图片网络路径
    // httpUrl:"http://localhost:8088/images",
    httpUrl:"https://www.kongbai121.xyz/miniapp/images",

    //后台地址
    // myUrl:"http://localhost:8080",
    myUrl:"https://www.kongbai121.xyz/miniapp",

    //(为了减轻服务器负担,只在演示时开)
    //我的页面数据更新定时器开关
    // openTime: false,
    openTime: true,
   },

})
